<template>
  <view class="my-search-container" :style="{'background-color':bgcolor}" @click="searchBoxHandler">
    <view class="my-search-box" :style="{'border-radius':bordRadius+'px'}">
      <!-- 使用uni-ui 提供的图标组件 -->
      <uni-icons type="search" size="30"></uni-icons>

      <text class="placeholder">搜索</text>
    </view>
  </view>
</template>

<script>
  export default {
    props: {
      bgcolor: {
        type: String,
        default: '#a60003'
      },
      bordRadius: {
        type: Number,
        default: 17
      }
    },
    data() {
      return {

      };
    },
    methods: {
      searchBoxHandler() {
        console.log(`~~~`);
        this.$emit('searchClick')
      }
    }
  }
</script>

<style lang="scss">
  .my-search-container {
    // background-color: #a60003;
    height: 60px;
    display: flex;
    align-items: center;
    padding: 0 10px;

    .my-search-box {
      width: 100%;

      height: 34px;
      background-color: #fffdff;
      display: flex;
      justify-content: center;
      align-items: center;

      .placeholder {
        font-size: 14px;
        margin-left: 4px;
      }
    }
  }
</style>